# 程序猿鼓励师
from pynput import keyboard
from playsound import playsound
from threading import Thread
count = 0
def onRelease(key):
    """
    这个函数就是在用户释放键盘按键的时候,被调用到
    :param key:用户按下了哪个键
    :return:
    """
    print(key)
    global count
    count+=1
    if count%10==0:
        # 播放音频
        t = Thread(target=playsound,args=("once.mp3",))
        t.start()

listener= keyboard.Listener(on_release=onRelease)
listener.start()
listener.join()